<?php

/**
 * Caddocenviados form base class.
 *
 * @method Caddocenviados getObject() Returns the current form's model object
 *
 * @package    SCBE
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseCaddocenviadosForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'iddocenviados'     => new sfWidgetFormInputHidden(),
      'idpedido'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cadpedido'), 'add_empty' => false)),
      'iddocumentos'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Caddocumentos'), 'add_empty' => false)),
      'dataregistro'      => new sfWidgetFormDate(),
      'enderecodocumento' => new sfWidgetFormTextarea(),
      'situacao'          => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'iddocenviados'     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('iddocenviados')), 'empty_value' => $this->getObject()->get('iddocenviados'), 'required' => false)),
      'idpedido'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cadpedido'))),
      'iddocumentos'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Caddocumentos'))),
      'dataregistro'      => new sfValidatorDate(array('required' => false)),
      'enderecodocumento' => new sfValidatorString(array('required' => false)),
      'situacao'          => new sfValidatorString(array('max_length' => 1, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('caddocenviados[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Caddocenviados';
  }

}
